<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection"
	content="telephone=no,email=no,date=no,address=no">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/aui.css" />
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<link rel="stylesheet" type="text/css"
	href="../css/aui-pull-refresh.css" />
<style>
			.aui-content-padded {
				padding: 0.75 rem;
				background-color: #ffffff;
				margin-top: 0.75 rem;
			}
			.aui-list-item-label {
				font-size: 14px;
			}
			.aui-list-item-inner .input-class {
				font-size: 13px;
			}
			.aui-list-item-input {
				font-size: 13px;
			}
</style>
</head>
<body>
	<header class="aui-bar aui-bar-nav aui-bar-warning" id="aui-header">
	<a class="aui-pull-left" onclick="window.history.back(-1);"> <span
		class="aui-iconfont aui-icon-left"></span>
	</a>
	<div class="aui-title">我的活动</div>
	<a class="aui-pull-right"> </a> </header>
	
	
			<div class="aui-searchbar" id="search">
			<div class="aui-searchbar-input aui-border-radius">
				<i class="aui-iconfont aui-icon-search"></i>
				<input type="search" placeholder="请输入活动名称" id="search-input">
				<div class="aui-searchbar-clear-btn">
					<i class="aui-iconfont aui-icon-close"></i>
				</div>
			</div>
			<div class="aui-searchbar-btn" tapmode>
				取消
			</div>
		</div>
		<section class="aui-content">
			<ul class="aui-list aui-media-list" id="nice-articles" style="padding-bottom: 50px;">
				<!--
				<li class="aui-list-item aui-list-item-middle" onclick="openDetailed()">
				<div class="aui-media-list-item-inner">
				<div class="aui-list-item-inner aui-list-item-arrow">
				<div class="aui-list-item-text">
				<div class="aui-list-item-title aui-font-size-14">
				市场活动记录
				</div>
				<div class="aui-list-item-right">
				2017-08-02
				</div>
				</div>
				</div>
				</div>
				</li>-->
			</ul>
		</section>
		<section id="list"></section>
		<!-- <div class="aui-toast"  style="display:none;" id="loading">
			<div class="spinner aui-toast-content">
				<div class="spinner-container container1">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				</div>
				<div class="spinner-container container2">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				</div>
				<div class="spinner-container container3">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				</div>
			</div>
		</div> -->
</body>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="../js/aui-dialog.js" ></script>
<script type="text/javascript" src="../js/aui-search.js"></script>


<script type="text/javascript">
	//得到选择机会信息的id
	var id = "${param.id}";
	var dialog = new auiDialog({});
	//当前初始页
	var pageNumber = 1;
	//每页显示多少条
	var pageSize = 10;
	var countSize = 0;

	//初始方法
	$(function(){
		$("#nice-articles").html("");
		$("#list").html("");
		getPage(1, 99);
	});


	//打开详细
	function openDetailed(id) {
		window.location.href = "${pageContext.request.contextPath}/wap/public_customer.do?path=market_detailed&id="+id;
	}

	function getPage(pageNumber, pageSize) {
		var activityName = $("#search-input").val();
		$("#loading").show();
		$.ajax({
					url : '${pageContext.request.contextPath}/appcrm/customerActivityList.do',
					type : "POST",
					data : {
						pageNo : pageNumber,
						pageSize : pageSize,
						activityName : activityName,
						customerId: "${loginCustomer.customerId}"
					},
					dataType : "json",
					success : function(data) {
						var rets = data;
						if (rets.code == 0 && rets.code != "undefined") {
							if (rets.pageInfo.list != "" && rets.pageInfo.list != null) {
								var da = rets.pageInfo.list;
								var html = "";
								for (var i = 0; i < da.length; i++) {
									html += '<li class="aui-list-item aui-list-item-middle" onclick="openDetailed(\'' + da[i].activityId + '\')"><div class="aui-media-list-item-inner"><div class="aui-list-item-inner aui-list-item-arrow"><div class="aui-list-item-text">'
									if (da[i].activityName != null && da[i].activityName != "") {
										html += '<div class="aui-list-item-title aui-font-size-14">' + da[i].activityName + '</div>'
									}
									if (da[i].createDate != null && da[i].createDate != "") {
										html += '<div class="aui-list-item-right">' + toDateTime(da[i].createDate) + '</div>'
									}
									html += "</div></div></div></li>";
								}
								countSize = rets.pageInfo.pageCount;
								//复制总记录数
							} else {
								$("#list").html("<div style='width:100%;text-align:center;color:#999;padding:10px 0;'>暂无数据！</div>");
							}
							
							$("#nice-articles").append(html);

							// api.addEventListener({
							// 	name : 'scrolltobottom',
							// 	extra : {
							// 		threshold : '100',            //当事件为scrolltobottom时，设置距离底部多少距离时触发事件，默认值为0，数字类型
							// 	},
							// }, function(ret, err) {
							// 	pageNumber++;
							// 	if (pageNumber * 10 - 10 < countSize) {
							// 		getPage(pageNumber, pageSize);
							// 	} else {
							// 		if (Math.ceil(countSize / 10) == pageNumber - 1) {
							// 			$("#list").html("<div style='width:100%;text-align:center;color:#999;padding:10px 0;'>没有更多数据了！</div>");
							// 		}
							// 	}
							// });
						}

					}
				});
	}





</script>
</html>